#define _CRT_SECURE_NO_WARNINGS 1
//Guessing Numbers Game
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<windows.h>
void menu()
{
	printf("**********  welcome to  *********\n");
	printf("***** Guessing Numbers Game *****\n");
}
void game()
{
	int choice = 0;
	int random = rand() % 100 + 1;
	while (1)
	{
		printf("Please enter:\n");
		scanf("%d", &choice);
		if (choice > random)
		{
			printf("Guess it's too big\n");
			printf("\n");
		}
		else if (choice < random)
		{
			printf("Guess it's too small\n");
			printf("\n");
		}
		else
		{
			printf("Congratulations, you guessed it right\n");
			Sleep(3000);
			system("cls");
			break;
		}
	}
}
int main(void)
{
	int input = 0;
	srand((unsigned int)time(NULL));
	do
	{
		menu();
		printf("Please select: 0 or 1\n");
		scanf("%d", &input);
		switch (input)
		{
		case 1:	system("cls"); game(); break;
		case 0:printf("game over\n"); break;
		default:printf("Selection error, please reselect\n"); break;
		}
	} while (input);
	return 0;
}